<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
    	<link href="../css/mui.picker.min.css" rel="stylesheet" />
		<link href="../style/fjol_style.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../style/xol_style.css"/>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav newbgRed">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">意见反馈</h1>
		</header>
		<div class="mui-content p10">
			<p class="mt10">反馈类型</p>
			<form class="mui-input-group">
			    <div class="mui-input-row p10" id="feedbackType" style="line-height: 40px;">
			    </div>
			</form>
			<p class="mt10">反馈内容</p>
				<textarea name="" rows="5" class="color9 feedback-con">请留下您宝贵的意见或建议</textarea>
			<button type="button" class="mui-btn newbgRed colorWhite borderRadius6 mui-btn-block" id="submitBtn">提交</button>
		</div>
		<script src="../js/mui.min.js"></script>
		<script src="../js/mui.picker.min.js"></script>
		<script src="../js/md5.js"></script>
		<script src="../js/enum.util.js"></script>
		<script src="../js/common.util.js"></script>
		<script src="../js/network.js"></script>
		<script type="text/javascript">
			mui.init();
			var clientId;
			mui.plusReady(function(){
				var wv = plus.webview.currentWebview();
				clientId = wv.clientId;
			
			/******************选择反馈类型*********************/
			var userInfo = common.myStorage.getItem('userInfo');
			var feedbackTypeName = '产品问题';
			var feedbackTypeEnumValue = 1;
			var isContent = false;
			document.querySelector('#feedbackType').innerHTML = feedbackTypeName;
			document.querySelector('#feedbackType').addEventListener('tap',function(){
				var feedbackTypePicker = new mui.PopPicker();
				var feedbackTypeArr = new Array();
				var getfeedbackType = enumUtils.getEnumDataByType('feedbackType');
				for (i in getfeedbackType) {
					feedbackTypeArr[i]={
						text:getfeedbackType[i].name,
						value:getfeedbackType[i].value
					}
				}
				feedbackTypePicker.setData(feedbackTypeArr);
				feedbackTypePicker.pickers[0].setSelectedValue('fourth', 2000);
				feedbackTypePicker.show(function(SelectedItem) {
					feedbackTypeName = SelectedItem[0].text;
					feedbackTypeEnumValue = SelectedItem[0].value;
					document.querySelector('#feedbackType').innerHTML = feedbackTypeName;
				});
			});
			document.querySelector('.feedback-con').addEventListener('focus',function(){
				var txtCls = this.classList;
				isContent = true;
				if(this.classList.contains('color9')){
					this.value = '';
					this.classList.remove('color9');
				}else{}
			});
			document.querySelector('.feedback-con').addEventListener('blur',function(){
				if(this.value==''){
					this.value = '请留下您宝贵的意见或建议';
					this.classList.add('color9');
					isContent = false;
				}else{
					isContent = true;
				}
			});
			
			document.querySelector('#submitBtn').addEventListener('tap',function(){
				var feedbackContent = document.querySelector('.feedback-con').value;
//				console.log(feedbackContent);
				if(!isContent){
					mui.alert('请留下您的宝贵意见或建议');
					return false;
				}else{
					var param = [{
						key:'clientId',
						value:clientId
					},{
						key:'content',
						value:feedbackContent
					},{
						key:'feedBackTypeEnumValue',
						value:feedbackTypeEnumValue
					},{
						key:'feedBackTypeEnumName',
						value:feedbackTypeName
					}];
					fjNetwork.post('fjzx/client/add-issues.json',param,function(data){
//						console.log(JSON.stringify(data));
						mui.toast(data.msg);
						mui.back();
					},function(msg){
						mui.toast(msg);
					});
				}
			});
			
			})
		</script>
	</body>

</html>